package com.haohope.framework.wb.online;

import java.util.List;
import org.json.JSONArray;
import org.json.JSONObject;
import com.haohope.framework.wb.GridResult;

public class OnlineSessionGridResult extends GridResult<OnlineSessionVo> {
	/**
	 * 
	 */
	private static final long serialVersionUID = -5881818448125177036L;
	public OnlineSessionGridResult(long total, List<OnlineSessionVo> rows) {
		super(total, rows);
	}
	public String toString() {
		JSONObject result = new JSONObject();
		JSONArray rows = new JSONArray();
		for(OnlineSessionVo vo:this.getRows()) {
			JSONObject row = new JSONObject();
			row.put("ip", vo.getIp());
			row.put("userAgent", vo.getUserAgent());
			row.put("createDate", vo.getCreateDate());
			row.put("lastAccessDate", vo.getLastAccessDate());
			rows.put(row);
		}
		result.put("rows", rows);
		result.put("total", this.getTotal());
		return result.toString();
	}

}
